<?php
$this->headTitle('Phân quyền','append');
?>
<div class="grid">
    <div class="breadcrumbs">
        <a class="item-1" href="/index">Trang chủ</a> › 
        <a class="item-2" href="/admin/role"><?php $title = $this->headTitle(); if(isset($title[0])) echo $title[0]; ?></a>
        <div class="clear-both"></div>
    </div>
	   <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <thead>
                <tr>
                    <td class="column">STT</td>
                    <td class="column">Mã quyền</td>
                    <td class="column">Tên quyền</td>
                    <td class="column">Trang chủ</td>
                    <td class="column">Game</td>
                    <td class="column">
                        <?php if($this->acl->checkResource($this->auth,'admin','role','add')){ ?>
                            <a class="bnt-add" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'add'));?>">
                                Thêm mới
                            </a>
                        <?php }else{ ?>
    						Chức năng
                        <?php } ?>
                    </td>
                </tr>
            </thead>
            <tbody>
                <?php
                    $stt = 1;
                    foreach ($this->roleList as $role){
                ?>
                    <tr class="row row-<?php echo $stt;?>">
                        <td class="column text-align-center"><?php echo $stt;?></td>
                        <td class="column text-align-center"><?php echo $role['roleId'];?></td>
                        <td class="column">
                            <?php if($this->acl->checkResource($this->auth,'admin','role','edit')){ ?>
                                <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'edit', 'id'=>$role['roleId']));?>" title="Sửa thông tin role">
                                    <?php echo $role['roleName'];?>
                                </a>
                            <?php }else{ ?>
                                <?php echo $role['roleName'];?>
                            <?php } ?>
                        </td>
                        <td class="column text-align-center"><?php echo $role['homepage'];?></td>
                        <td class="column"><?php echo str_replace(array('[',']','","','"'), array('','',', ',''),$role['gameId']);?></td>
                        <td class="column text-align-center">
                            <?php if($this->acl->checkResource($this->auth,'admin','role','edit')){ ?>
                                <a class="icon icon-edit" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'edit', 'id'=>$role['roleId']));?>" title="Sửa thông tin role">
                                    <img src="image/icons/icon_edit.png" alt="edit role" border="0"/>
                                </a>
                            <?php 
                                }
                                if($this->acl->checkResource($this->auth,'admin','role','delete')){
                                    if($this->roleCheck['roleId'] != $role['roleId']){
                            ?>
                        			<a class="icon icon-delete" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'delete', 'id'=>$role['roleId']));?>" title="Xóa role">
                                        <img src="image/icons/icon_delete.png" alt="delete role" border="0"/>
                                    </a>
                            <?php 
                                    }
                                } 
                            ?>
                        </td>
                    </tr>
                <?php
                    ++$stt; 
                    } 
                ?>
            </tbody>
        </table>
</div>